package com.lovo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lovo.bean.Address;
import com.lovo.mapper.AddressMapper;
import com.lovo.service.IAddressService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * ?û????ջ???ַ? 服务实现类
 * </p>
 *
 * @author lovo
 * @since 2022-09-17
 */
@Service
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService {



    @Autowired
    AddressMapper addressMapper;
    @Override
    public List<Address> findAddressById(Integer userId) {
        QueryWrapper<Address> qw = new QueryWrapper<>();
        qw.eq("userId",userId);
        List<Address> list = addressMapper.selectList(qw);
        return list;
    }

    @Override
    public void addAddress(Address address) {
        addressMapper.insert(address);
    }

    @Override
    public void delAddress(Integer addressId) {
        addressMapper.deleteById(addressId);
    }
}
